import Vue from "vue";
import "./styles/index.scss"; // global css
import App from "./App.vue";
import router from "./router";

import "./plugins/element.js";

import TreeTable from "vue-table-with-tree-grid";

import NProgress from "nprogress"; // progress bar
import "nprogress/nprogress.css"; // progress bar style

import * as echarts from "echarts";
Vue.prototype.$echarts = echarts;

Vue.config.productionTip = false;

Vue.component("tree-table", TreeTable);

import axios from "axios";
import VueAxios from "vue-axios";
axios.defaults.baseURL = "http://127.0.0.1:8001/";
// axios.defaults.baseURL = "http://82.157.176.4:80/";
axios.interceptors.request.use((config) => {
  // console.log(config);
  NProgress.start();
  config.headers.Authorization = sessionStorage.getItem("token");
  return config;
});
axios.interceptors.response.use((config) => {
  NProgress.done();
  return config;
});

Vue.use(VueAxios, axios);

import store from "./store";

//关闭vue警告
Vue.config.silent = true;

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
